package com.hxci.fanhaonan.controller;

import com.hxci.fanhaonan.dao.StudentfhnDao;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("stu")
public class StudentfhnController<Studentfhn> {
    @Autowired
    StudentfhnDao studentfhnDao;

    @RequestMapping("query")
    public String query(Model model){
        List<Studentfhn> list = studentfhnDao.query();
        model.addAttribute("list",list);
        return "list";
    }
    @RequestMapping("add")
    public String add(){
        return "add";
    }

    @RequestMapping("save")

    public String save(  Studentfhn studentfhn){
        int a = studentfhnDao.save(studentfhn);
        return "redirect: query";
    }

    @RequestMapping("del")
    public String del(Integer id){
        int a = studentfhnDao.del(id);
        return "redirect: query";
    }

    @RequestMapping("index")
    public String index(){
        return "index";
    }
}
